"""
文件名: JL_BerAttentionController.py
作用: 会员关注品牌管理的接口,每一个接口都有一个对应的方法,该方法用于测试用例
作者: 姜黎
"""

from Untils.SendMethod import SendMethod
from Interface.DHX_MemberInterface import MemberInterface


class MemberAttentionController:
    def __init__(self):
        self.url = 'http://139.159.146.104:8083'
        self.mi = MemberInterface()

    def attention_add(self, brandid):
        """
        添加品牌关注
        :return:
        """
        payload = {
            "memberId": 2,
            "brandId": brandid

        }

        headers = self.mi.get_token(username='liar', password='123456')
        url = self.url + '/member/attention/add'
        return SendMethod.send_method(method='post', url=url, json=payload, headers=headers)

    def attention_list(self):
        """
           显示关注
           :return:
           """
        headers = self.mi.get_token(username='liar', password='123456')
        url = self.url + f'/member/attention/list/2'
        return SendMethod.send_method(method='get', url=url, headers=headers)

    def attention_delete(self, brandid):
        """
        取消关注
        :return:
        """
        payload = {
            "memberId": 2,
            "brandId": brandid
        }

        headers = self.mi.get_token(username='liar', password='123456')
        url = self.url + '/member/attention/delete'
        return SendMethod.send_method(method='post', url=url, data=payload, headers=headers)


if __name__ == '__main__':
    hc = MemberAttentionController()
    print(hc.attention_delete(3))
